<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        li{
            list-style: none;
            line-height: 60px;
        }
        ul{
            width: 600px;
            margin: 100px auto;
            border:1px solid;
        }
        li{
            height: 60px;
            text-indent: 2em;
            background-color: rgba(0,0,0,.2);
            border-bottom: 1px solid rgba(0,0,0,.1);
        }
    </style>
    <!-- 开发版 -->
    <script src="./vue.js"></script>
</head>
<body>
    <div id="app">
        <ul>
            <li v-for="book in books" v-on:click="change" :key="book">{{book}}</li>
        </ul>
    </div>

    <script>
        var app = new Vue({
            el:'#app',
            data:{
                books:[
                    '西游记','水浒传','红楼梦','三国演义'
                ]
            },
            methods:{
                change(event){
                    event.target.style.background = 'rgba(0,0,0,.5)'
                }
            }
        })
    </script>
</body>
</html>